import yaml
import pytest
from selenium import webdriver
from selenium.webdriver.common.by import By
import time

def test_yaml_login():
    with open('yaml.yaml','r',encoding='utf-8') as f:
        return yaml.safe_load(f)
@pytest.mark.parametrize('test_case',test_yaml_login())

def test_login(test_case):
    driver=webdriver.Edge()
    driver.maximize_window()
    driver.get("http://10.59.9.14:7003/")

    driver.find_element(By.LINK_TEXT, '登录').click()
    time.sleep(2)
    driver.find_element(By.NAME, 'username').send_keys(test_case['username'])
    driver.find_element(By.NAME, 'password').send_keys(test_case['password'])
    time.sleep(10)
    driver.find_element(By.CLASS_NAME, 'finish-btn').click()
    time.sleep(5)